package es.ceura.wilder.configuration;

import java.io.IOException;
import java.util.Properties;

/**
 *
 * @author Jorge Madrid
 */
public enum Config {

    INSTANCE;
    public static final String lOG_PATH = "logPath",
            BUFFER_SIZE = "bufferSize",
            MAX_THREADS = "maxThreads",
            PORT = "port",
            HOME = "home",
            INDEX = "index",
            LIST_DIRS = "listDirs",
            TIMEOUT = "timeout",
            _404 = "404";
    Properties properties;
    private boolean isLoaded = false;

    private Config() {
    }

    public void loadConfiguration() throws IOException {
        if (!isLoaded) {
            isLoaded = true;
            properties = new Properties();
            properties.load(Config.class.getResourceAsStream("config.properties"));
        }
    }

    public String getConfigVar(String key) {
        return properties.getProperty(key);
    }
}
